package com.example.ui.learn.util;

import java.util.ArrayList;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.huashangapp.R;
import com.example.net.NetRequest;



import com.example.util.AsyncLoadImage;

public class MyListViewAdapter5 extends BaseAdapter{
	private LayoutInflater inflater;
	private ArrayList<Recommend> list;
	private AsyncLoadImage asyncLoadImage;

	public MyListViewAdapter5(Context mContext,
			ArrayList<Recommend> list,AsyncLoadImage ali) {
		inflater = LayoutInflater.from(mContext);
		this.list = list;
		this.asyncLoadImage=ali;
	}

	public ArrayList<Recommend> getCcInfos() {
		return list;
	}

	public void setCcInfos(ArrayList<Recommend> list) {
		this.list = list;
		if (list == null) {
			this.list = new ArrayList<Recommend>();
		}
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}
    
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
	
		Recommend mc=list.get(position);

		final String url =mc.getPicid();

		convertView = inflater.inflate(R.layout.ra_listitem, null);
		final ImageView imageView;			
		imageView = (ImageView)convertView.findViewById(R.id.rl_pic);
		imageView.setTag(url);	
		
		asyncLoadImage.imageLoader.displayImage(url, imageView,asyncLoadImage.options);
				
			imageView.setTag(url);			
       

		return convertView;
	}	
	
}
